<!doctype html>
<html>
    <head>
        <meta charset="UTF-8"/>
        <title>logger总汇</title>        
    </head>
    <body>
    
<?php

function _getFiles($path) {
    $files = scandir($path);
    if(count($files) > 2 && is_dir($path)) {
        unset($files[0], $files[1]);
        $new_files = array();
        foreach ($files as $file) {
            $new_files[] = $file;
        }
        return $new_files;
    }
    return false;
}
$ip = $_SERVER['SERVER_ADDR'];    
$host = "http://" . $_SERVER['HTTP_HOST'] . '/log/logger/';
$path = dirname(__FILE__) . '/logger/';

$files = _getFiles($path);
if(!$files) return;
krsort($files);
$html = '';

foreach ($files as $file) {
    $href = $host . $file;  
    $html .= "<a href='{$href}' target='_blank'> {$file} </a><br/>";    
}
echo $html;
?>
</body>
</html>